#ifndef __CH_CFG_WIFI_PROFILE_H__
#define __CH_CFG_WIFI_PROFILE_H__

#include <stdint.h>
#include <core/mercku_error.h>

#include <mdat.h>

#define DAT_WIFI_PROFILE_2G "/etc/wireless/mediatek/mt7915.dbdc.b0.dat"
#define DAT_WIFI_PROFILE_5G "/etc/wireless/mediatek/mt7915.dbdc.b1.dat"
#define DAT_USE_MAP "/etc/map/mapd_user.cfg"

typedef enum
{
    WBE2g = 0, /**< 2.4G频段*/
    WBE5g,     /**< 5G频段*/
    WBEMax
} WifiBandEnum;

typedef enum
{
    WDIMain = 0,
    WDIGuest,
    WDIMesh,
    WDIWifi5,
} WifiDatIndex;

#define CH_WIFI_BAND_TO_PROFILE_ID(__band__) (__band__) // 2g[0], 5g[1]
#define CH_WIFI_SSID_TO_PROFILE_ID(__ssid__) (__ssid__) // min[0], max[3]

#define CH_WIFI_PROFILE_BUFF_LEN (256)

// HT_BW
// 0: 20 MHz
// 1: 20/40 MHz

// VHT_BW
// 0: disable
// 1: 80M
// 2: 160M
// 3: 80M+80M
// clang-format off
typedef enum {
    CH_WIFI_MTK_HTBW_MODE_HT20 = 0,
    CH_WIFI_MTK_HTBW_MODE_HT40,
    CH_WIFI_MTK_HTBW_MODE_VHT_DISABLE = 0,
    CH_WIFI_MTK_HTBW_MODE_VHT80,
    CH_WIFI_MTK_HTBW_MODE_VHT160,
    CH_WIFI_MTK_HTBW_MODE_VHT80P80,
}ch_wifi_mtk_hwband_e;

typedef enum {
    CH_WIFI_MTK_HT40_EXTCHA_BLOW = 0,
    CH_WIFI_MTK_HT40_EXTCHA_ABOVE
}ch_wifi_mtk_ht40_e;
// clang-format on

// 0: legacy 11b/g mixed
// 1: legacy 11b only
// 2: legacy 11a only
// 4: legacy 11g only
// 6: 11n only in 2.4g band
// 7: 11gn mixed
// 8: 11an mixed
// 9: 11bgn mixed
// 11: 11n only in 5g band
// 14: 11A/AN/AC mixed 5G band only
// 15: 11AN/AC mixed 5G band only
// 16: 11bgn/AX mixed 2.4G band only
// 17: 11A/AN/AC/AX mixed 5G band only
typedef enum {
    CH_WIFI_MTK_MODE_11B_2G_ONLY = 1,        // 2G-ONLY
    CH_WIFI_MTK_MODE_11G_2G_ONLY = 4,        // 2G-ONLY
    CH_WIFI_MTK_MODE_11B_G_2G_MIXED = 0,     // 2G-MIXED
    CH_WIFI_MTK_MODE_11N_2G_ONLY = 6,        // 2G-ONLY
    CH_WIFI_MTK_MODE_11GN_2G_MIXED = 7,      // 2G-MIXED
    CH_WIFI_MTK_MODE_11BGN_2G_MIXED = 9,     // 2G-MIXED
    CH_WIFI_MTK_MODE_11BGN_AX_2G_MIXED = 16, // 2G-MIXED

    CH_WIFI_MTK_MODE_11A_5G_ONLY = 2,            // 5G-ONLY
    CH_WIFI_MTK_MODE_11N_5G_ONLY = 11,           // 5G-ONLY
    CH_WIFI_MTK_MODE_11AN_5G_MIXED = 8,          // 5G-MIXED
    CH_WIFI_MTK_MODE_11A_AN_AC_5G_MIXED = 14,    // 5G-MIXED
    CH_WIFI_MTK_MODE_11AN_AC_5G_MIXED = 15,      // 5G-MIXED
    CH_WIFI_MTK_MODE_11A_AN_AC_AX_5G_MIXED = 17, // 5G-MIXED
} ch_wifi_mtk_hwmode_e;

/**
 * @brief 从 band 创建一个新的 session 对象。
*/
MError *mdat_new_session_for_wifi_from_band(WifiBandEnum band, MDatSession **session);
MError *mdat_new_session_for_mapd(MDatSession **session);

#endif
